import 'package:floor/floor.dart';
import 'package:share_fit/app/dao/dao_mixin.dart';
import 'package:share_fit/app/models/sports/effect_model.dart';

@dao
abstract class EffectDao with DaoMixin<EffectModel> {
  @override
  @Query('SELECT * FROM sports_effect WHERE _id = :id')
  Stream<EffectModel?> findById(int id);

  @override
  @Query('SELECT * FROM sports_effect')
  Future<List<EffectModel>> findAll();

  @override
  @Query('SELECT * FROM sports_effect')
  Stream<List<EffectModel>> findAllAsStream();

  @override
  @Query('delete FROM sports_effect')
  Future<void> deleteAll();

  @Query('SELECT * FROM sports_effect WHERE date_created >= :startTime and date_created < :endTime')
  Future<List<EffectModel>> findBy(int startTime, int endTime);

  @Query('delete FROM sports_effect where address = :address')
  @override
  Future<void> deleteAllByAddress(String address);
}
